package com.zfei.gfb.device;


import com.zfei.gfb.core.Context;
import com.zfei.gfb.model.GfbUser;

/**
 * @author fgh
 */
public class AppContext {

    public static final String KEY = "X-AppContext";
    public static final String SESSION = "X-Session";
    public static final String SESSION_H5_GUEST = "X-Session-Guest";
    public static final String SESSION_H5_COMPANY = "X-Session-Company";
    public static final String SESSION_H5_VILLAGER = "X-Session-Villager";
    public static final String SESSION_WEB_USER = "X-Session-User";

    public static AppContext getInstance() {
        return (AppContext) Context.current().getAttachments().computeIfAbsent(KEY, k -> new AppContext());
    }

    public static void removeInstance() {
        Context.current().removeAttachment(KEY);
    }

    private Integer uid ;

    private Integer type ;

    private String admin;

    private String clientType;

    private String clientVersion;

    //唯一用户标记，用户类型+"_"+id
    private String identifierId;

    private GfbUser gfbUser;
    
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public String getAdmin() {
        return admin;
    }

    public void setAdmin(String admin) {
        this.admin = admin;
    }

    public String getClientType() {
        return clientType;
    }

    public void setClientType(String clientType) {
        this.clientType = clientType;
    }

    public String getClientVersion() {
        return clientVersion;
    }

    public void setClientVersion(String clientVersion) {
        this.clientVersion = clientVersion;
    }

    public String getIdentifierId() {
        return identifierId;
    }

    public void setIdentifierId(String identifierId) {
        this.identifierId = identifierId;
    }

    public GfbUser getGfbUser() {
        return gfbUser;
    }

    public void setGfbUser(GfbUser gfbUser) {
        this.gfbUser = gfbUser;
    }
}
